-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to ofetch #904
base: master
Are you sure you want to change the base?
Migrate to ofetch #904
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #904 +/- ##
===========================================
+ Coverage 44.19% 72.15% +27.96%
===========================================
Files 22 22
Lines 2100 2144 +44
Branches 195 249 +54
===========================================
+ Hits 928 1547 +619
+ Misses 1162 590 -572
+ Partials 10 7 -3
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
Fixed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK
package.json
Outdated
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@snapshot-labs/snapshot.js", | |||
"version": "0.6.2", | |||
"version": "1.0.0-beta.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? We shouldn't go from a normal version to a beta. Also not sure we should bump to v1. I dont see any change in function or parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty major change in error handling from ofetch, as pointed out in yesterday call. Beta will be released and tested only interbally first, and not for public
@Todmy Can you test this PR, utACK is not enough |
@wa0x6e could you please test your tests? I run them and have some failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests should be fixed
Tests are passing on my local, and on github actions 🤔 What are the errors you're seeing ? |
Added retry to flaky tests depending on third party services |
issue persists. The reason why tests fail on my local host is that I use node@18. This package is used for projects with node@18 as well. |
Hmmmm… have to start adding node 18 to ci |
|
Tests fixed for node 18, also confirmed to work on node 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
I believe this should not be merged on |
Maybe we can leave it on this branch, can i publish it to beta tag? |
I don’t think it’s possible to have 2 versions on the same branch, it’ll create a merge conflict |
Published this branch to https://www.npmjs.com/package/@snapshot-labs/snapshot.js/v/0.8.0-beta.0 |
🧿 Current issues / What's wrong ?
Current
fetch
request does not support timeout, nor keep alive connections.💊 Fixes / Solution
Migrate the fetch library from
cross-fetch
toofetch
.The error handling changes from
ofetch
will also introduce a change in returned response on error.Previously, error handling looks like:
With ofetch changes,
🚧 Changes
getJSON
andipfsGet
(see below)getScores
,validate
andgetVp
code
=== string)code
=== number)The last argument (
options
) accepts atimeout
property.subgrapherRequest
andgetSnapshot
The last argument (
options
) accepts atimeout
property.getJSON
andipfsGet
FetchError
The last argument (
options
) accepts atimeout
property.send
(from Client)FetchError
ofetch
is handling error response differently, and is rejecting a Promise on all non-200 errors.This new update will require a bump to the next major version (1.x.x).
As this new breaking change need more testing before public release, the new 1.x.x should be released as a beta, and used only by our internal services first (and keep updated with the main branch) for a few weeks.
Once everything confirmed as working as expected, then we can public release it.
🛠️ Tests
getScores
,validate
,getSnapshot
andgetVp
functions with valid data